package publisherSubscriber;

import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;

import cosEventComm.Disconnected;
import cosEventComm.PushConsumer;

public class Publisher {
	private PushConsumer supplier;
	private String publisherName;
	
	protected Publisher(String publisherName,PushConsumer supplier) {
		super();
		this.supplier = supplier;
		this.publisherName = publisherName;
	}

	public String getPublisherName() {
		return publisherName;
	}
	
	public void disconnect(){
		supplier.disconnect_push_consumer();
	}

	
	public void write(String string) throws Disconnected{
		Any a = ORB.init().create_any();
		a.insert_string(string);
		supplier.push(a);
	}
	
	

}
